import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import legacy from '@vitejs/plugin-legacy'
import styleImport from 'vite-plugin-style-import'
import { elementlibs } from './src/plugins/element-plus'
// import config from './admin.config.js'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require('path')
// https://vitejs.dev/config/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// import.meta.env.VITE_APP_TITLE = config.title
export default defineConfig(async () => {
    return {
        plugins: [
            vue(),
            vueJsx(),
            legacy({
                targets: ['ie >= 11'],
                additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
            }),
            styleImport({
                libs: [elementlibs],
            }),
        ],
        // alias: {
        //     '@': path.join(__dirname, 'src'),
        // },
        resolve: {
            alias: [
                {
                    find: '@',
                    replacement: path.resolve(__dirname, 'src'),
                },
            ],
        },
    }
})
